package com.gagakuai.bpm.rpcservice.openfeign;



import com.gagakuai.bpm.config.httpclients.FeignConfig;
import com.gagakuai.bpm.config.httpclients.FeignUserHttpApiFallBackFactory;
import com.gagakuai.bpm.domian.dto.response.ResponseStatusDto;
import com.gagakuai.bpm.domian.dto.scheduleTask.BPMUserVo;
import com.gagakuai.bpm.domian.entity.camuda.TaskInfoEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;


/*
 * 用于请求获取的用户信息
 */

@FeignClient(name = "userHttpApi",url = "http://localhost:8081",fallbackFactory = FeignUserHttpApiFallBackFactory.class,
        decode404 = true,
        configuration = FeignConfig.class)
public interface UserHttpApi {

   @RequestMapping(value = "/ca/user/v2/getUserInfo", method = RequestMethod.GET)
   ResponseStatusDto<List<BPMUserVo>> getSystemUserInfoList();

   // 危险源回写流程实例ID
   @RequestMapping(value = "/ca/hazardCache/saveToMainTable/{businessId}", method = RequestMethod.GET)
   ResponseStatusDto<Void> updateProcId(@PathVariable("businessId") String businessId);

   // 任务完成获取下一个节点信息
   @RequestMapping(value = "/ca/unsafeEvent/updateProcActivityInfos/{businessId}", method = RequestMethod.POST)
   ResponseStatusDto<Void> updateProcActivityInfos(@PathVariable("businessId") String businessId,
                                                   @RequestBody List<TaskInfoEntity> taskInfoEntityList);

   // 回调业务接口，处理数据
   @RequestMapping(value = "/ca/hazardCache/copyData/{businessId}", method = RequestMethod.GET)
   ResponseStatusDto<Void> copyData(@PathVariable("businessId") String businessId);

   // 更新安全隐患库
   @RequestMapping(value = "/ca/hazardCache/UpdateSecurityRisks/{businessId}", method = RequestMethod.GET)
   ResponseStatusDto<Void> UpdateSecurityRisks(@PathVariable("businessId") String businessId);

   // 回写当前流程发起的其它流程（业务ID与实例ID）
   @RequestMapping(value = "/ca/unsafeEvent/backStartSubProcInfo/{businessId}", method = RequestMethod.POST)
   ResponseStatusDto<Void> backStartSubProcInfo(@PathVariable("businessId")String businessId, @RequestBody List<String> listBusinessIdAndProcInstId);

   // 生成不符合项
   @RequestMapping(value = "/ca/hazardCache/AutoGenerateNonconformity/{businessId}", method = RequestMethod.GET)
   ResponseStatusDto<Void> autoGenerateNonconformity(@PathVariable("businessId") String businessId);
}
